package com.newenergy.wisehome.gateway.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.newenergy.wisehome.R;
import com.newenergy.wisehome.data.bean.BLDeviceInfo;

public class BLDeviceInfoAdapter extends RecyclerArrayAdapter<BLDeviceInfo> {
    public BLDeviceInfoAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ViewHolder(viewGroup) ;
    }

    private class ViewHolder extends BaseViewHolder<BLDeviceInfo> {

        private TextView tv_name;
        private TextView tv_did;
        private TextView tv_key;
        private TextView tv_room_id;
        private TextView tv_status;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_bl_device_info);
            tv_name = $(R.id.tv_name);
            tv_did = $(R.id.tv_did);
            tv_key = $(R.id.tv_key);
            tv_room_id = $(R.id.tv_room_id);
            tv_status = $(R.id.tv_status);
        }

        @Override
        public void setData(BLDeviceInfo item) {
            super.setData(item);
            tv_name.setText("name: "+item.getName());
            tv_did.setText("did: "+item.getDid());
            tv_key.setText("key: "+item.getKey());
            tv_room_id.setText("id: "+item.getId() + "");
            tv_status.setText("familyId: "+item.getFamilyId());

        }
    }
}
